package com.clayecloud.common.client.controller;

import com.clayecloud.common.client.services.VisitorService;
import com.clayecloud.common.entity.Visitor;
import com.clayecloud.common.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ClayeLink
 * @date 2022/4/8 15:57
 */
@RestController
@RequestMapping("/visiter")
@Api(tags = "访问")
public class ClientVisitorController {

    @Resource
    private VisitorService visitorService;

    @PostMapping("/insert")
    @ApiOperation("添加访问申请")
    public MessageUtil insert(@RequestBody Visitor visitor){
        return visitorService.insert(visitor);
    }

    @GetMapping("/select")
    @ApiOperation("查询用户的申请记录")
    public MessageUtil selectByUserID(Long userID){
        return visitorService.selectByUserID(userID);
    }

}
